package com.atguigu.spzx.manner.controller;

import com.atguigu.spzx.manner.service.FileUploadService;
import com.atguigu.spzx.model.myemun.ResultCodeEnum;
import com.atguigu.spzx.model.vo.common.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/admin/system")
public class FileUploadController {
    @Autowired
    private FileUploadService fileUploadService ;
    @PostMapping("/fileUpload")
    public Result fileUpload(@RequestParam(value = "file") MultipartFile file) {
      String fileUrl =   fileUploadService.fileUpload(file);
      return Result.build(fileUrl, ResultCodeEnum.SUCCESS);
    }

}
